-
Notifications
You must be signed in to change notification settings - Fork 0
Fix Select Storybook tests: query portaled content, wait for triggers, and stabilize assertions #150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Select Storybook tests: query portaled content, wait for triggers, and stabilize assertions #150
Conversation
- Query listbox/options from document.body for portaled menus - Wait for triggers with findBy* before interaction - Use role-based queries and verify combobox text updates - Fix custom region selection to use an existing option (California) Refs: ensure ARIA roles (combobox/listbox/option) are respected
|
|
|
📝 Storybook Preview: View Storybook This preview will be updated automatically when you push new changes to this PR.
|
|
🔍 Broken test auto-fixer • Learn more
|
- Replace getByLabelText with findByLabelText to wait for component render - Ensures test stability by avoiding race conditions on initial render - Follows same pattern as other fixed select tests in the PR
|
✅ Fixed all failing checks on PR #150! Issue IdentifiedThe test failure was in the Root CauseThe issue was a race condition where the test was trying to interact with the select component before it had fully rendered, causing the "Unable to find role='listbox'" error. Solution Applied
Results
The fix follows the same pattern that was already established in the other select tests in this PR, ensuring consistency and reliability across all Storybook tests. 💻 View my work • 🛑 Stop • 🚫 Ban all checks • React 👍 or 👎 |
…rtaled-select-test-3a1f
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests
Comment |
- Add role='listbox' to CommandList component in Select - Add role='option' to all CommandItem components (regular options and creatable options) - This ensures proper ARIA semantics for screen readers and test queries - Fixes failing CreatableOption test that was looking for listbox role The issue was that the Select component was using cmdk library components without explicit ARIA roles, causing tests to fail when querying for role='listbox' and role='option' elements.
|
✅ Fixed the failing Select Storybook tests! Problem IdentifiedThe test failure was in the Root CauseThe Select component was using the
Solution AppliedI added the missing ARIA roles to the Select component (
Results
The fix ensures proper ARIA semantics for accessibility while making the tests work correctly. The Select component now properly exposes its dropdown structure to both screen readers and test queries. 🔗 Updated PR: The fix has been pushed to the existing PR #150 branch 💻 View my work • 🛑 Stop • 🚫 Ban all checks • React 👍 or 👎 |
- Replace setTimeout with proper await for listbox and search input elements - Use findByRole and findByPlaceholderText for better async handling - Ensures dropdown and search input are fully rendered before interaction - Fixes race condition that was causing 'Unable to find role=listbox' error Co-authored-by: Jake Ruesink <jake@lambdacurry.com>
|
✅ Fixed the failing check suite on PR #150! Issue IdentifiedThe Root CauseThe test had a race condition where it was trying to find the portaled dropdown elements before they were fully rendered. The original code used Solution Applied
Results
The fix has been pushed to the existing PR branch and should resolve the failing GitHub Actions check. The changes are minimal and focused, only improving the async handling without changing the test logic or functionality. 💻 View my work • 🛑 Stop • 🚫 Ban all checks • React 👍 or 👎 |
Updated the CreatableOption test to wait for the dropdown to open before attempting to find the listbox role. This change replaces the previous timing delay with a timeout parameter, enhancing test reliability and reducing flakiness.
Updated the select stories to include a timeout when retrieving the listbox role, ensuring that the dropdown has fully opened before interaction. Added assertions to verify the presence of specific options, improving test reliability and reducing flakiness across multiple story scenarios.
Updated select stories to improve listbox retrieval with fallback mechanisms for better reliability. Added error handling to ensure that dropdown options are accessible even if the initial listbox approach fails. This change enhances test stability and reduces flakiness across various scenarios.
Enhanced select stories by adding explicit waits for component loading before interactions. This change ensures that the dropdowns are fully rendered and interactive, reducing flakiness in tests and improving overall reliability across various scenarios.
…est reliability Refactored select stories to remove redundant error handling and fallback mechanisms, ensuring a more straightforward approach to listbox interactions. This change enhances the clarity of the tests and maintains reliability by ensuring that dropdowns are fully rendered before interaction, reducing flakiness across various scenarios.
Requester: Jake Ruesink
Summary
What changed
Why
CI readiness
Notes
💻 View my work • About Codegen
⛔ Remove Codegen from PR • 🚫 Ban action checks